package com.bosicen.crm.service.sysmanage;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import com.bosicen.crm.dao.entity.OrderProcess;
import com.bosicen.crm.dao.process.OrderProcessDao;
import org.springframework.transaction.annotation.Transactional;
/**
 * 订单流程
 * @author tigerlei
 *
 */
@Service("orderProcessService")
public class OrderProcessServiceImpl {
	@Autowired
	private OrderProcessDao orderProcessDao;

	// @Transactional(readOnly = false,propagation=Propagation.REQUIRED,
	// rollbackFor=Exception.class)

	/****
	 * 查询列表
	 * 
	 * @param companyid
	 * @return
	 */
	public List<OrderProcess> findOrderProcessList(int id) {
		List<OrderProcess> list = null;
		try {
			list = this.orderProcessDao.findOrderProcessList(id);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return list;
	}


	/****
	 * 查询列表
	 * 
	 * @param companyid
	 * @return
	 */
	public List<OrderProcess> findOrderProcessList() {
		List<OrderProcess> list = null;
		try {
			list = this.orderProcessDao.findOrderProcessList();
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return list;
	}
	
	/***
	 * 新增/修改
	 * 
	 * @param p
	 */
	@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
	public boolean saveOrUpdateOrderProcess(OrderProcess p) {
		try {
			 this.orderProcessDao.saveOrUpdate(p);
		} catch (Exception ex) {
			ex.printStackTrace();
			return false;
		}
		return true;
	}

	/****
	 * 按ID查询
	 * 
	 * @param companyid
	 * @return
	 */
	public OrderProcess findOrderProcessById(int id) {
		OrderProcess orderProcess = null;
		try {
			orderProcess = this.orderProcessDao.findOrderProcessById(id);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return orderProcess;
	}

	/****
	 * 删除 
	 * 
	 * @param p
	 */
	@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
	public boolean delOrderProcess(OrderProcess p) {
		try {
			this.orderProcessDao.delOrderProcess(p);
		} catch (Exception ex) {
			ex.printStackTrace();
			return false;
		}
		return true;
	}
	
	

}
